package com.animallife.android.util;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class JSONParser {

	public static final String RESPONSE_DATA = "responseData";
	public static final String RESULTS = "results";
	public static final String UNESCAPED_URL = "unescapedUrl";

	public JSONParser() {

	}

	public String[] getImageUrlsArray(JSONObject obj) throws JSONException {

		JSONArray jsons = obj.getJSONObject(RESPONSE_DATA).getJSONArray(RESULTS);
		int len = jsons.length();
		String[] array = new String[len];
		for (int i = 0; i < len; i++) {

			array[i] = jsons.getJSONObject(i).getString(UNESCAPED_URL);

		}

		return array;
	}

}
